﻿using Relocation.Controls;
using System.Drawing;
using Relocation.Base;
using Relocation.Data;

namespace Relocation
{
	static public class Expend
	{
		/// <summary>
		/// 返回树形
		/// </summary>
		static public MainTreeView GetMainTreeView(this Session source)
		{
			return source.Map.ContainsKey(Session.KEY_MAIN_TREE_VIEW)?source.Map[Session.KEY_MAIN_TREE_VIEW] as MainTreeView:null;
		}

		static public void SetMainTreeView(this Session source, MainTreeView mainTreeView)
		{
			if (source.Map.ContainsKey(Session.KEY_MAIN_TREE_VIEW))
			{
				source.Map[Session.KEY_MAIN_TREE_VIEW] = mainTreeView;				
			} else
			{
				source.Map.Add(Session.KEY_MAIN_TREE_VIEW, mainTreeView);
			}
		}

		/// <summary>
		/// 返回主窗体
		/// </summary>
		static public MainWindow GetMainWindow(this Session source)
		{
			return source.Map.ContainsKey(Session.KEY_MAIN_WINDOW) ? source.Map[Session.KEY_MAIN_WINDOW] as MainWindow : null;
		}

		

	}
}
